import request from '@/utils/request'
import { fetchOcr } from '@/utils/request'
import { getToken } from '@/utils/auth'

// 查询客户信息列表
export function listCustomer(query) {
  return request({
    url: '/travel/customer/list',
    method: 'get',
    params: query
  })
}

// 查询客户信息详细
export function getCustomer(customerId) {
  return request({
    url: '/travel/customer/' + customerId,
    method: 'get'
  })
}

// 新增客户信息
export function addCustomer(data) {
  return request({
    url: '/travel/customer',
    method: 'post',
    data: data
  })
}

// 修改客户信息
export function updateCustomer(data) {
  return request({
    url: '/travel/customer',
    method: 'put',
    data: data
  })
}

// 删除客户信息
export function delCustomer(customerId) {
  return request({
    url: '/travel/customer/' + customerId,
    method: 'delete'
  })
}

// 导出客户信息
export function exportCustomer(query) {
  return request({
    url: '/travel/customer/export',
    method: 'get',
    params: query
  })
}

// OCR识别身份证 - 真实 API 调用
export function ocrIdCard(imageUrl) {
  return fetchOcr('/travel/customer/ocr/idcard', imageUrl);
}

// OCR识别身份证 - 备选方案（真实 API 调用）
export function ocrIdCardAlt(imageUrl) {
  return fetchOcr('/travel/customer/ocr/idcard', imageUrl);
} 